package com.zhudi.utils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.zhudi.domain.User;
import com.zhudi.service.UserService;
import com.zhudi.service.impl.UserServiceImpl;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;

import javax.annotation.Resource;

import static com.zhudi.contant.UserContant.SALT;
public class UserUtils {
    static UserService userService = new UserServiceImpl();
   public static User getSafetyUser(User user){
        User safeUser = new User();
        safeUser.setId(user.getId());
        safeUser.setUserName(user.getUserName());
        safeUser.setAvatar(user.getAvatar());
        safeUser.setNickname(user.getNickname());
        safeUser.setPhone(user.getPhone());
        safeUser.setRole(user.getRole());
        return safeUser;
    }

    public static String getencryptPassword(String password){
       return  DigestUtils.md5DigestAsHex((SALT + password).getBytes());
    }


}
